'use strict'
//引入koa模块
let koa = require('koa')
let fs = require('fs')
//为koa新建一个对象
let text = new koa()

let port = 5555
//使用对象
text.use(async (ctx, next) => {
    //获取用户请求路径
    if (ctx.request.path === '/Desk.html'){
        //设置内容类型
        ctx.type = 'text/html'
        //为身体注入灵魂
        ctx.body = fs.createReadStream('./Desk.html')
    }else{
        await next();
    }
}).listen(port)

function msg(){
    console.log(`http://localhost:${port}`);
}

msg()

